package androidx.gdata.spreadsheets;

import androidx.gdata.LinkUrl;
import androidx.gdata.ThingWithLinks;

import java.io.Serializable;

public class Worksheet extends ThingWithLinks implements Serializable {
  
  private String id;
  private String updated;
  private String title;
  private WorksheetContent content;
  private static final String LIST_FEED =
    "http://schemas.google.com/spreadsheets/2006#listfeed";
  
  public Worksheet(String id, String updated, String title,
      WorksheetContent content, LinkUrl[] links) {
    super(links);
    this.id = id;
    this.updated = updated;
    this.title = title;
    this.content = content;
  }

  public String getListUrl() {
    LinkUrl[] links = getLinks();
    for (int i = 0; i < links.length; i++) {
      if (links[i].getRel().equals(LIST_FEED)) {
        return links[i].getHref();
      }
    }
    return null;
  }
  
}
